package requests

import (
	"app/common/customtype"
	"app/common/params"

	"github.com/shopspring/decimal"
)

type SupplierAddRequest struct {
	Phone    string `json:"phone" validate:"required|cn_mobile" label:"手机号" filter:"trim"` //手机号
	Email    string `json:"email" validate:"email" label:"邮箱" filter:"trim"`
	Username string `json:"username" validate:"required" label:"账号" filter:"trim"` //用户账号
	Password string `json:"password" validate:"required" label:"密码" filter:"trim"` //密码
	Avatar   string `json:"avatar" filter:"trim"`
	PayPass  string `json:"payPass" filter:"trim"`
	Qq       string `json:"qq" filter:"trim"`
}

type SupplierEditRequest struct {
	Id              int64           `json:"id" validate:"required" label:"ID"`
	Phone           string          `json:"phone" validate:"cn_mobile" label:"手机号" filter:"trim"` //手机号
	Email           string          `json:"email" validate:"email" filter:"trim" label:"邮箱"`
	Username        string          `json:"username" label:"账号" filter:"trim"`                                         //用户账号
	Password        string          `json:"password" validate:"maxLen:20|minLen:6|alphaDash" label:"密码" filter:"trim"` //密码
	Avatar          string          `json:"avatar"`
	PayPass         string          `json:"payPass"`
	Qq              string          `json:"qq"`
	NegativeBalance decimal.Decimal `json:"negativeBalance"` //欠款额度
}

// 用户登录
type SupplierLoginPasswordRequest struct {
	Username string `gorm:"column:username;" json:"username" validate:"required" label:"用户名"` //用户名
	Password string `gorm:"column:password;" json:"password" validate:"required" label:"密码"`  //登录密码
}

type SupplierStateRequest struct {
	Id    int64 `json:"id" validate:"required"`
	State int8  `json:"state" validate:"required|min:1|max:3"` //商家状态 1正常 2禁用 3注销
}

// 密码修改
type SupplierEditPasswordRequest struct {
	Password   string `gorm:"column:password;" json:"password" validate:"required|eqField:RePassword" label:"密码"` //新密码
	RePassword string `gorm:"-" json:"rePassword" validate:"required" label:"确认密码"`                               //确认密码
}

type SupplierDeleteRequest struct {
	Id int64 `json:"id" validate:"required"`
}

type SupplierListRequest struct {
	State           int8                 `json:"state" form:"state"`                     //1 正常 2禁用 3注销
	Username        string               `json:"username" form:"username"`               //
	Phone           string               `json:"phone" form:"phone"`                     //
	AgentId         int64                `json:"agentId" form:"agentId"`                 //代理ID 0为总站
	CreateTimeStart customtype.LocalTime `json:"createTimeStart" form:"createTimeStart"` //
	CreateTimeEnd   customtype.LocalTime `json:"createTimeEnd" from:"createTimeEnd"`     //
	params.ParamsPagination
}

type SupplierTokenRequest struct {
	SupplierId int64 `json:"supplierId" form:"supplierId" validate:"required" label:"商家ID"`
}

type SupplierRecharge struct {
	Amount       decimal.Decimal `json:"amount" gorm:"column:amount" validate:"required" label:"充值金额"`               //充值金额
	RechargeType int8            `json:"rechargeType" gorm:"column:recharge_type"`                                   //充值类型1微信2支付宝3银行转账
	Image        string          `json:"image" gorm:"column:image" validate:"required" label:"转账图片"`                 //转账图片
	Payee        string          `json:"payee" gorm:"column:payee" validate:"required" label:"收款人"`                  //收款人
	PayeeBank    string          `json:"payeeBank" gorm:"column:payee_bank" validate:"required" label:"收款银行"`        //收款银行
	Remark       string          `json:"remark" gorm:"column:remark"`                                                //备注
	SerialNumber string          `json:"serialNumber" gorm:"column:serial_number" validate:"required" label:"支付流水号"` //支付流水号
}

type SupplierRechargeByYy struct {
	Amount decimal.Decimal `json:"amount" gorm:"column:amount" validate:"required" label:"充值金额"` //充值金额
	// RechargeType int8            `json:"rechargeType" gorm:"column:recharge_type"`                            //充值类型1微信2支付宝3银行转账4线下
	Image string `json:"image" gorm:"column:image" validate:"required" label:"转账图片"` //转账图片
	// Payee        string          `json:"payee" gorm:"column:payee" validate:"required" label:"收款人"`           //收款人
	// PayeeBank    string          `json:"payeeBank" gorm:"column:payee_bank" validate:"required" label:"收款银行"` //收款银行
	Remark     string `json:"remark" gorm:"column:remark"`                             //备注
	SupplierId int64  `json:"supplierId" gorm:"column:supplierId" validate:"required"` //商家ID
	// SerialNumber string          `json:"serialNumber" gorm:"column:serial_number" validate:"required" label:"支付流水号"` //支付流水号
}

// 提现
type TakeOutRequest struct {
	Amount  float64 `json:"amount" gorm:"column:amount" validate:"required|min:10" message:"提现金额最少10元"`    //金额
	Payee   string  `json:"payee" gorm:"column:payee" validate:"required" filter:"trim" label:"收款人"`       //收款人
	Bank    string  `json:"bank" gorm:"column:bank" validate:"required" filter:"trim" label:"开户行"`         //开户行
	BankNum string  `json:"bankNum" gorm:"column:Bank_num" validate:"required" filter:"trim" label:"银行卡号"` //银行卡号
}
